{include file='index/_header.html'}

<div class="top-header" style="background-image: url(__STATIC__/themes/__THEME__/img/banner.jpg)">
    <div class="container">
        <h2 class="top-title">{$topic.title}</h2>
        <p class="lead top-description">
            {$topic.subtitle}
            <span class="pull-right"><a href="{:url('index/index')}">首页 </a>  &raquo; <a href="{$topic.nav_href}">{$topic.title}</a></span>
        </p>
    </div>
</div>

<div class="container blog mtn">

    <div class="row">
        <!-- content -->
        <div class="col-sm-9">
            {php $list=db($topic['model_table'])->cache()->field('content', true)->where($page_where)->where('status=1')->order('is_top DESC,sort ASC,id DESC')->paginate(10)}
            <div class="blog-top">
                {if $page_type==1:}{$topic.nav_title}{/if}
                {if $page_type==2:}{$topic.title}{/if}
                {if $page_type==3:}关键字： <span class="text-danger">{$keyword}</span>{/if}
                {if $page_type==4:}标签： <span class="text-danger">#{$tag}</span>{/if}
                <span class="pull-right">共 {$list->attr('total')} 篇文章</span>
            </div>
            {empty $list->toArray():}
            <div class="blog-top" style="border-top:none;">暂无记录！</div>
            {/empty}

            <div class="row mtn">
                {php $offset=$list->attr('offset')}
                {foreach $list as $k=>$vo}
                {php $k=$k+1+$offset}
                {if $k<=4 && $page_type==1:}
                <div class="col-sm-6">
                    <div class="media">
                        <div class="media-left media-top">
                            <a href="{:url('news/detail',['id'=>$vo['id']])}"><img src="{:rand_thumb($vo['thumb'], $k)}" alt="thumb" /></a>
                        </div>
                        <div class="media-body">
                            <div class="media-heading">
                                {if $vo['is_top']==1:}<span class="text-danger">置顶</span>{/if} <a href="{:url('news/detail',['id'=>$vo['id']])}">{$vo.title}</a>
                            </div>
                            <div class="media-content">
                                {$vo.summary}
                            </div>
                            <div class="media-footer">
                                <a href="{:echo($topic['sub_nav'][$vo['tid']]['href'])}"><i class="glyphicon glyphicon-th-large"></i> {:echo($topic['sub_nav'][$vo['tid']]['title'])}</a>
                                <a href="{:url('news/detail',['id'=>$vo['id']])}" class="read pull-right">阅读</a>
                            </div>
                        </div>
                    </div>
                </div>
                {else:}
                <div class="col-sm-12">
                    <div class="media">
                        <div class="media-left media-top">
                            <a href="{:url('news/detail',['id'=>$vo['id']])}"><img src="{:rand_thumb($vo['thumb'], $k)}" alt="thumb" /></a>
                        </div>
                        <div class="media-body">
                            <div class="media-heading">
                                {if $vo['is_top']==1:}<span class="text-danger">置顶</span>{/if} <a href="{:url('news/detail',['id'=>$vo['id']])}">{$vo.title}</a>
                            </div>
                            <div class="media-content">
                                {$vo.summary}
                            </div>
                            <div class="media-footer">
                                <a href="{:echo($topic['sub_nav'][$vo['tid']]['href'])}"><i class="glyphicon glyphicon-th-large"></i> {:echo($topic['sub_nav'][$vo['tid']]['title'])}</a>
                                <i class="glyphicon glyphicon-time"></i> {$vo.update_time|date='Y-m-d'}&nbsp;&nbsp;
                                <i class="glyphicon glyphicon-eye-open"></i> {$vo.read_count}&nbsp;&nbsp;
                                <span class="pull-right">
                                {php $tags=widget('common.tags')->get($vo['tags_ids'])}
                                {foreach $tags as $sign=>$name}
                                    <a href="{:url('news/index', ['tag'=>$sign])}">#{$name}</a>&nbsp;&nbsp;
                                {/foreach}
                                </span>
                            </div>
                        </div>
                    </div>
                </div>
                {/if}
                {/foreach}
            </div>


        </div>
        <!-- sidebar -->
        <div class="col-sm-3">
            {include file='index/_sidebar.html'}
        </div>
    </div>

</div>
{include file='index/_footer.html'}
<script>
    $(document).ready(function () {
        $('#search').click(function () {
            "" != $("#keyword").val() ? location.href = "{:url('news/index')}?keyword=" + $("#keyword").val() : toast('请输入关键字');
        });
    });
</script>
</body>
</html>